package com.hudilao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hudilao.entity.Stock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * StockMapper接口，用于操作库存表
 */
@Mapper
public interface StockMapper extends BaseMapper<Stock> {
    @Select("SELECT s.quantity FROM stock s JOIN dish d ON s.dish_id = d.id WHERE d.id = #{dishId}")
    Integer getStockByDishId(long dishId);
}

